home *** CD-ROM | disk | FTP | other *** search
/ Aminet 33 / Aminet 33 - October 1999.iso / Aminet / dev / c / amiga-c-jun99.lha / amiga-c / june1999 / files / sound.c < prev    next >
Encoding:
C/C++ Source or Header  |  1999-07-03  |  1011 b   |  64 lines

  1. /*
  2. ** Sample Player
  3. */
  4.  
  5. #include <proto/exec.h>
  6. #include <proto/dos.h>
  7. #include <dos/dostags.h>
  8. #include <clib/datatypes_protos.h>
  9. #include <clib/alib_protos.h>
  10. #include <datatypes/datatypes.h>
  11. #include <datatypes/datatypesclass.h>
  12. #include <datatypes/soundclass.h>
  13.     struct Library *DataTypesBase;
  14.  
  15. void snd_Play(void);
  16. void snd_spawn(void (*func)(void));
  17. void __asm __saveds snd_play(void);
  18.  
  19.  
  20. main()
  21. {
  22. snd_Play();
  23. }
  24.  
  25.  
  26. void snd_Play(void)
  27. {
  28.     snd_spawn(snd_play);
  29.  
  30.  
  31. }
  32.  
  33.  
  34. void snd_spawn(void (*func)(void))
  35. {
  36.     CreateNewProcTags(NP_Entry,func,TAG_DONE);
  37. }
  38.  
  39.  
  40. void __asm __saveds snd_play(void)
  41. {
  42.     struct Library *DataTypesBase;
  43.     Object *sound;
  44.     struct dtTrigger trigger;
  45.  
  46.     DataTypesBase = OpenLibrary("datatypes.library",0);
  47.  
  48.  
  49.  
  50.     if ((sound=NewDTObject("PROGDIR:Message.wav", DTA_GroupID, GID_SOUND, TAG_DONE))==0) return;
  51.  
  52.     trigger.MethodID = DTM_TRIGGER;
  53.     trigger.dtt_GInfo = NULL;
  54.     trigger.dtt_Function = STM_PLAY;
  55.     trigger.dtt_Data = NULL;
  56.     DoDTMethodA(sound,0L,0L,(Msg)&trigger);
  57.  
  58.  
  59.  
  60.  
  61.  
  62.     DisposeDTObject(sound);
  63. }
  64.